import { Component, OnInit } from '@angular/core';
import { AbstractControl, FormBuilder, FormGroup } from '@angular/forms';
export function amountValidator(c: AbstractControl): { [key: string]: any } | null {
  let num = c.value;
  return !isNaN(num) && num > 0 ? null : { numberInvalid: true };
}
@Component({
  selector: 'app-currency',
  templateUrl: './currency.component.html',
  styleUrls: ['./currency.component.scss'],
})
export class CurrencyComponent implements OnInit {
  private form: FormGroup;

  constructor(private fb: FormBuilder) {}

  ngOnInit() {
    this.form = this.fb.group({
      amount: [0, amountValidator],
    });
  }

  private onSubmit({ value, valid }: { value: Object; valid: boolean }) {
    console.log(value);

    // this.issuePriceChange.emit({ type: 'submit', value, valid });
  }
}
